﻿using CommonDevelop;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using WebAdmin.Handler;

namespace WebAdmin.Controllers
{
    /// <summary>
    /// 首页
    /// </summary>
    public class HomeController : BaseController
    {
        private readonly ILogger<HomeController> logger;
        private readonly IPathProvider pathProvider;
        /// <summary>
        /// 构造
        /// </summary>
        public HomeController(IPathProvider pathProvider, ILogger<HomeController> ilogger)
        {
            this.pathProvider = pathProvider;
            this.logger = ilogger;
        }
        /// <summary>
        /// Index
        /// </summary>
        public IActionResult Index()
        {
            ViewBag.Title = "System:" + this.Current.FullName;
            return View();
        }
        /// <summary>
        /// Main
        /// </summary>
        public ActionResult Main()
        {
            if (string.IsNullOrWhiteSpace(GlobalData.DomainPath))
                GlobalData.DomainPath = this.pathProvider.GetHostUri(this.Request);

            return RedirectToAction("Index", "Home");
        }
    }
}
